package com.time.concurrency.one;

/**
 * @program: tes
 * @description:
 * @author: xuejingjing
 * @create: 2021-10-21 11:53
 **/
public class VarInMethodMain {
    public static void main(String[] args) {

        HasSelfPrivateNum hasSelfPrivateNum = new HasSelfPrivateNum();

        VarINMethodThreadA varINMethodThreadA = new VarINMethodThreadA(hasSelfPrivateNum);
        varINMethodThreadA.start();

        VarINMethodThreadB varINMethodThreadB = new VarINMethodThreadB(hasSelfPrivateNum);
        varINMethodThreadB.start();

        /**
         * 访问同一个类中同一个方法中的变量，线程安全
         * a set over!
         * b set over!
         * b num =200
         * a num =100
         *
         * 访问同一个类中的成员变量，非线程安全
         * a set over!
         * b set over!
         * b num =200
         * a num =200
         */
    }
}
